package Chatter::API::Schema::Result::Thread;

# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use namespace::autoclean;
extends 'DBIx::Class::Core';

#__PACKAGE__->load_components("InflateColumn::DateTime");

__PACKAGE__->table("thread");

__PACKAGE__->add_columns(
  "threadId",
  { data_type => "varchar", is_nullable => 0, size => 100 },
  "accountId",
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 100 },
  "groupId",
  { data_type => "varchar", is_nullable => 1, size => 100 },
  "tweet",
  { data_type => "text", is_nullable => 0 },
  "posted",
  {
    data_type     => "timestamp",
    is_nullable   => 0,
    datetime_undef_if_invalid => 1,
  },
  "updated",
  {
    data_type     => "timestamp",
    is_nullable   => 1,
    datetime_undef_if_invalid => 1,
  },
  "replyCount",
  { data_type => "integer", is_nullable => 1 },
  "url",
  { data_type => "varchar", is_nullable => 1, size => 1000 },
);
__PACKAGE__->set_primary_key("threadId");

__PACKAGE__->has_many(
  "replies",
  "Chatter::API::Schema::Result::Reply",
  { "foreign.threadId" => "self.threadId" },
  { order_by => { -asc => 'posted' }, cascade_copy => 0, cascade_delete => 0 },
);

__PACKAGE__->has_many(
  "repliesDesc",
  "Chatter::API::Schema::Result::Reply",
  { "foreign.threadId" => "self.threadId" },
  { order_by => { -desc => 'posted' }, cascade_copy => 0, cascade_delete => 0 },
);

__PACKAGE__->belongs_to(
  "account",
  "Chatter::API::Schema::Result::Account",
  { accountId => "accountId" },
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);

__PACKAGE__->meta->make_immutable;
1;
